package cn.edu.hust.sse.software7.class3.serviceImpl;

import java.util.List;
import java.util.logging.Logger;

import cn.edu.hust.sse.software7.class3.DAO.EBShoppingCarDAO;
import cn.edu.hust.sse.software7.class3.entities.EBShoppingCar;
import cn.edu.hust.sse.software7.class3.service.EBShoppingCarService;

public class EBShoppingCarServiceImpl implements EBShoppingCarService {
	EBShoppingCarDAO dao = new EBShoppingCarDAO();

	public EBShoppingCarServiceImpl() {
		if (dao == null) {
			dao = new EBShoppingCarDAO();
		}
		Logger.getLogger(EBShoppingCarServiceImpl.class.getName());
	}

	@Override
	public void createSCar(EBShoppingCar shoppingCar) {
		dao.createSCar(shoppingCar);
	}


	@Override
	public void clearSCar(Long userId) {
		dao.clearSCar(userId);
	}

	@Override
	public List<EBShoppingCar> getByUserId(Long userId) {
		return dao.getByuserid(userId);
	}

	@Override
	public void deleteSCar(EBShoppingCar car) {
		dao.deleteCarById(car);
	}

	@Override
	public boolean isEsistCar(EBShoppingCar car) {
		// TODO Auto-generated method stub
		return dao.isExistCar(car);
	}

}
